UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'GVhH2cKh/eoaky9mZZ5Y7FThziIlBrTsuSMLEERMQZg='
WHERE
key_id = 'cd4250c03a40e168f89b601aadde69fab8c649065c4cb1022433456d0257e27c'
AND (
token = 'GVhH2cKh/eoaky9mZZ5Y7FThziIlBrTsuSMLEERMQZg='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)