UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = '5gYhT/MLq8q4AhKjqrbn6Bm3FgSriaeHh9/C4e6QgX8='
WHERE
key_id = 'd9b97aff3ac8a423cb51846aeb2bda21cbd1a0a85ee90b2bec5dc857d88c6a0e'
AND (
token = '5gYhT/MLq8q4AhKjqrbn6Bm3FgSriaeHh9/C4e6QgX8='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)