UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'dy9OuCg6gNz6iil38bA4OIHTsOP0cUjz+kAQ/MxEcz4='
WHERE
key_id = 'b119d721fd56972c4f5151516895479785e6a3cc9b1f8dee6af4630d910f3ea9'
AND (
token = 'dy9OuCg6gNz6iil38bA4OIHTsOP0cUjz+kAQ/MxEcz4='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)