UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'AOZwCqbmi0K2CPqS3PSCR58G5C7iqPt67WO01aUto68=' 
WHERE 
  key_id = '1456e9b82750d39521024f4a91eeaacc56f3b1b265441b822b36912a1c090df1' 
  AND (
    token = 'AOZwCqbmi0K2CPqS3PSCR58G5C7iqPt67WO01aUto68=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00035