UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'li2C4lm7KH58WvlwUPcru0YDcXfljR9gR8Bps0WfdJA=' 
WHERE 
  key_id = '471d235eda05bd71da7c9b7c571eaa4eeeb6e35386608b49622456a603ff145a' 
  AND (
    token = 'li2C4lm7KH58WvlwUPcru0YDcXfljR9gR8Bps0WfdJA=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00040