UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'tOWFg6mmZFxdB0D/eAejHXYfttuwzJdUoup+OS/zXpQ=' 
WHERE 
  key_id = '7e5e90e90963fe9a3b07f00f0906bb2c0b51f6256d4f90ffddee34a64d4fbd3f' 
  AND (
    token = 'tOWFg6mmZFxdB0D/eAejHXYfttuwzJdUoup+OS/zXpQ=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00032