UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = '1qR65wQ569svLPlX98wanYVplZlxsh8CjOui/MWs7Fs=' 
WHERE 
  key_id = '821cd87b0917051d8b98470df941a2cd28def493f5288a20d03444ea7be07638' 
  AND (
    token = '1qR65wQ569svLPlX98wanYVplZlxsh8CjOui/MWs7Fs=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00028