UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'MdkG7tuJSQQXwKZX8S/bFR3TH5vVx4MlyZBHnhyK990='
WHERE
key_id = 'd9f04e2b5e13ae4a4a12231c803857c98f18cae0309bfa709714f17b9d238944'
AND (
token = 'MdkG7tuJSQQXwKZX8S/bFR3TH5vVx4MlyZBHnhyK990='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)