UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'KP/QDoCZkTky+6gLCHoO1J9Rel4lZXm9BnNTbBmsjRs=' 
WHERE 
  key_id = 'a669040d1e614a2c332fe6c36742455ffb8e2dc6b7d0461c3e904aff311689db' 
  AND (
    token = 'KP/QDoCZkTky+6gLCHoO1J9Rel4lZXm9BnNTbBmsjRs=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00031