UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'JV0iaP0yC4XEs0kWrOVA3oMkzqPHDJ5cddB1Slc3Vw0=' 
WHERE 
  key_id = '1f6a229942dcbcd6612fb516b1eb9f5eccd57758688b37c129b00cda7d6cb4a9' 
  AND (
    token = 'JV0iaP0yC4XEs0kWrOVA3oMkzqPHDJ5cddB1Slc3Vw0=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00038