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