UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'TzejW43bpGBXWu5egkyACyGVifIXN79MjlAN+CRq+Hw=' 
WHERE 
  key_id = 'd37a99de196ca9d927f2b6777aab8687226aa4e7f6401e419f891d321fe18b29' 
  AND (
    token = 'TzejW43bpGBXWu5egkyACyGVifIXN79MjlAN+CRq+Hw=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00031