UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'swBmmgAReAEUW5mBCI+iiS398J/mnZFOBvgsApJBgo0=' 
WHERE 
  key_id = '908147be497b84c5eeab8b77531b7687b3c8519a9174bce8cd59a7264b3f448b' 
  AND (
    token = 'swBmmgAReAEUW5mBCI+iiS398J/mnZFOBvgsApJBgo0=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00047