UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'ATKwlyeqGCKo1/XPrhgHTJeWwPYC6nW0sAsImiHhAEQ='
WHERE
key_id = 'dd4fb531e284d8aa82e19026c70d5465e4f72e1f0398134f5531b8fb417bc6c9'
AND (
token = 'ATKwlyeqGCKo1/XPrhgHTJeWwPYC6nW0sAsImiHhAEQ='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)