UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'carNh6PP5SBEqDS1TH2rCyQouaGKJUslSoj57PTZJ0Q='
WHERE
key_id = 'a10f5861c8ea938076ad67d528af6912097727f90bcd5a21b6f7184c091595ef'
AND (
token = 'carNh6PP5SBEqDS1TH2rCyQouaGKJUslSoj57PTZJ0Q='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)