UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'RjAom201WfehZy6lttAzSDRPAyN8P3lumu6q5zqcTZ0=' 
WHERE 
  key_id = '39f8f30ee707353f8a1e370632198fdf6340759724b51984e70cf644f76084d2' 
  AND (
    token = 'RjAom201WfehZy6lttAzSDRPAyN8P3lumu6q5zqcTZ0=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00032