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