UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'qcWXojQMao9xsSeoC4WUgddFAgGqn8P4MVoFOZS5eLE='
WHERE
key_id = 'c372d65849d2106947b313adda1824d10d193ba20a71e6283d0553015d10e5dd'
AND (
token = 'qcWXojQMao9xsSeoC4WUgddFAgGqn8P4MVoFOZS5eLE='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)