UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'GwquNM7O4aUdwbB7KbmHyi30nY2MZLMFhNDcoEmoOoc=' 
WHERE 
  key_id = 'b5a15b86aeb15add0d8482d51ee41ca59728b43368a81c0f589c08816149a819' 
  AND (
    token = 'GwquNM7O4aUdwbB7KbmHyi30nY2MZLMFhNDcoEmoOoc=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00021