UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'S4+3hKCgicvmFN/EBtAcMrdXzx2S8R2s55x0R+ZTisc=' 
WHERE 
  key_id = 'f9d2acd37454f93ea6ed0e274a3bbffdac6c0e5f319c51a635aa68522e9e1777' 
  AND (
    token = 'S4+3hKCgicvmFN/EBtAcMrdXzx2S8R2s55x0R+ZTisc=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00024