UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'H2lbV7wno4LtfG/BSBwK1jZJzJxaP3y00cAXLaS+c4w='
WHERE
key_id = 'b1239a7ec60b50bda157705286a1399f3703edb8e3fdb87e9704670b9f132c9b'
AND (
token = 'H2lbV7wno4LtfG/BSBwK1jZJzJxaP3y00cAXLaS+c4w='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)