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

Query time 0.00046