UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'C9dAqjZ7M/l/cA9SskIEctmgUEZOykm0ccHP4gsWg6c='
WHERE
key_id = 'bd6eb92d6749aea7934a09e0f980f49358059af50276275a04d4789e28afc05a'
AND (
token = 'C9dAqjZ7M/l/cA9SskIEctmgUEZOykm0ccHP4gsWg6c='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)