UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'QeJNBYUE4FzSD3W+8T4hWEph5DYl1qQ/VRvrvGcafCU=' 
WHERE 
  key_id = '3b3b5103557c8d42ebaff2ed3d4346e11e68471954d17e3b97239507cc09c310' 
  AND (
    token = 'QeJNBYUE4FzSD3W+8T4hWEph5DYl1qQ/VRvrvGcafCU=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00048