UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'mlh83fHa0c04SEBK7xoiIdxzPqj0PCq+9ckl6+Z9aSs=' 
WHERE 
  key_id = '7f7079261dbbd658a907507bb6375d60726e6ad5da6da888ba66b7be28173895' 
  AND (
    token = 'mlh83fHa0c04SEBK7xoiIdxzPqj0PCq+9ckl6+Z9aSs=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00104