UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'pkVHqDlJ7xrSMaeMvYIk+P9mW7AVSUYra1gPPXX9rjk='
WHERE
key_id = '2a65c1d37ff002fe526495fb0620c9e5fc5800c5b0e4b4799f43774ba64ccb5b'
AND (
token = 'pkVHqDlJ7xrSMaeMvYIk+P9mW7AVSUYra1gPPXX9rjk='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)