UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = '/rde0VCi9Hy8pXtEDzq9raypWNjLsbNyrBt3sZNkE+c='
WHERE
key_id = '9e8c58952e61e5ed76c6044b24b57dd6008431679e7c15a81d0a94d26d85f50e'
AND (
token = '/rde0VCi9Hy8pXtEDzq9raypWNjLsbNyrBt3sZNkE+c='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)