UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'd9a8nN8pf015Nm+HW5Plwqp9or0w/TSGxqj8yXC/Uwg='
WHERE
key_id = '2fd38f23aa0ee489af75a8487a21100e443afcbd7b542d2b7e38b30bcca50cec'
AND (
token = 'd9a8nN8pf015Nm+HW5Plwqp9or0w/TSGxqj8yXC/Uwg='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)