UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = '9aX3y/avqq7W10CD7114s53hTEAhMEri65+4TIM1SAs=' 
WHERE 
  key_id = 'e525c431a2a5038210a5dba0b07bc3900dd0afd6d47f50a0557a1ec6b9265639' 
  AND (
    token = '9aX3y/avqq7W10CD7114s53hTEAhMEri65+4TIM1SAs=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00025