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

Query time 0.00036