UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'tOG49gJDryE24bjNMbHg0cLfVGqsTw3h3R/TtA9T6Bo='
WHERE
key_id = 'b002e9665b4db5ec77dd4a3bfd717e62fd576e01f5562e7056bef31bea0365c6'
AND (
token = 'tOG49gJDryE24bjNMbHg0cLfVGqsTw3h3R/TtA9T6Bo='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)