UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'KSppXIL9taO7iWjwbmhUlF7zNC/eGJusNs4SThlpF+g=' 
WHERE 
  key_id = '8788b26403ee3f859c2a946fee77c231e40614a83d1afb7ecb1a16446d17e142' 
  AND (
    token = 'KSppXIL9taO7iWjwbmhUlF7zNC/eGJusNs4SThlpF+g=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00032