UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'fVMKHYjgxldCuKVGHE2tI7lyd13cXvSVq+vDjvstgi0=' 
WHERE 
  key_id = 'b799a7cc8ee5e1ce9ac62f19338b3ea520b95ec9bec2eae9731d4fc5e482aa68' 
  AND (
    token = 'fVMKHYjgxldCuKVGHE2tI7lyd13cXvSVq+vDjvstgi0=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00062