UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'nC9dCwjOXWIgRRRnovJfchlhM2Z9gtrtbJZWkDlRkgA='
WHERE
key_id = 'ddb419b7e8af78883b44a8eaf3e12e03bfc834a925066ad8adff9ac762f8dcf9'
AND (
token = 'nC9dCwjOXWIgRRRnovJfchlhM2Z9gtrtbJZWkDlRkgA='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)