UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = '58gJd0aQkDVA+CPbK0WaFOJyayLMRCDy0gb/7yaiUzI='
WHERE
key_id = '01b306c4599d54e32206c59076bc6b0210bea76a05a3c69c878e01b20e51136e'
AND (
token = '58gJd0aQkDVA+CPbK0WaFOJyayLMRCDy0gb/7yaiUzI='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)