UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = '5NxdghYkXA3Ox3irPWotiRtawpUC6qccFEinRXlnoXA=' 
WHERE 
  key_id = '83e35b4a888f1eb857bb34c697af2f50ea707ef11eb7994a4cda4387a5140853' 
  AND (
    token = '5NxdghYkXA3Ox3irPWotiRtawpUC6qccFEinRXlnoXA=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00034