UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'OLoM1640WbfcIrHUQ4e4JTl/oqGRrxHWSer2GCtzhdM=' 
WHERE 
  key_id = '24ad5ff8997e8ecf994d07cb4f7c7d5cc72e83a29abf920ba5832e7a939886f9' 
  AND (
    token = 'OLoM1640WbfcIrHUQ4e4JTl/oqGRrxHWSer2GCtzhdM=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00045