UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = '9fgib9mC+m9Q7MKTkDxxmWelu2Ihpc5oOzBLeBe3V70='
WHERE
key_id = '4c987fb789cc4b50a32cbeff34ace77455e48e24220f28db50d6fb437b37a193'
AND (
token = '9fgib9mC+m9Q7MKTkDxxmWelu2Ihpc5oOzBLeBe3V70='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)