UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'Er37nZ8lfqCO/4Uf0hNBdZkue+wzjQHUYJREmD1IupU='
WHERE
key_id = 'c6bf50066f930c55c6977cfa120fb037a9b3e70c49fc147ace7dc72aa45cab6c'
AND (
token = 'Er37nZ8lfqCO/4Uf0hNBdZkue+wzjQHUYJREmD1IupU='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)