UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = '/uuO4NYDUum48NJHvKUGZo2sIIse3BJlL5+Zwk5+PE4='
WHERE
key_id = 'dbe2a359689e223aa861521c982217b34eb15258ccc52867c3e5de35a021375d'
AND (
token = '/uuO4NYDUum48NJHvKUGZo2sIIse3BJlL5+Zwk5+PE4='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)