UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'dBmlM0Q/ax4/57BaJcLnW7Dg6JAm5NTPvBc1/OSok+E='
WHERE
key_id = 'f7f7862a3196e455c7792e691d963eb0f1be020663066b2fb170c53d82614ea3'
AND (
token = 'dBmlM0Q/ax4/57BaJcLnW7Dg6JAm5NTPvBc1/OSok+E='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)