UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'CuHgQIATghvOg8Ylbr/tBULHJaDAQtmmOTiQoHUwlSU='
WHERE
key_id = '77ca9463cfb4dafb8d4a85c5574e39d7269ce4b800e6d64e30c20edfa674e478'
AND (
token = 'CuHgQIATghvOg8Ylbr/tBULHJaDAQtmmOTiQoHUwlSU='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)