UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'HqvF3T+mgblwXf9nA7sp7zocuae8ioenBBxcPNzjre8=' 
WHERE 
  key_id = 'aeb7e166ab71952e8968d19159fd1bf52f91782e61c24ec9e5db76ff83eb3767' 
  AND (
    token = 'HqvF3T+mgblwXf9nA7sp7zocuae8ioenBBxcPNzjre8=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00029