UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = '0iwZS2OTfU6Mdrpsl7Oe9b3hZKtDW/TqITEPpZ23cCU='
WHERE
key_id = '46de948f161be07df513b5a3ca19b2be6c4d81b12af9c7465d19b350e673694c'
AND (
token = '0iwZS2OTfU6Mdrpsl7Oe9b3hZKtDW/TqITEPpZ23cCU='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)