UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'syDhwkjMYhsEMZJUWB+oXRJjyYYsteBfXCuoB5GJvdY='
WHERE
key_id = 'c36d521b217e9a8be86751ae2daabad3671a97bd1d61d8d741a03044b8218192'
AND (
token = 'syDhwkjMYhsEMZJUWB+oXRJjyYYsteBfXCuoB5GJvdY='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)