UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'NXqnkZbY1J6vdY1dokyMMvDOuUuEsvns7uW2+/GJYSQ='
WHERE
key_id = 'ef79a0077d9a6fe7953fa2c57ceed7467e3434d38f58d6af7f0675cedccb1340'
AND (
token = 'NXqnkZbY1J6vdY1dokyMMvDOuUuEsvns7uW2+/GJYSQ='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)