UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = '0DA6KLQ3QuEE3ASmbRlBo0p08BW1+5G1Zus/fBGGmPk='
WHERE
key_id = 'd586c6651b501a8cc424206033040e5def5e72e999d3456218ac357ee4c70e84'
AND (
token = '0DA6KLQ3QuEE3ASmbRlBo0p08BW1+5G1Zus/fBGGmPk='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)