UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'nPakx6whiNcyG69IzCScamhtEUr02kBCjzCeHrFSTvA='
WHERE
key_id = '40551c97061d77b53bfcec8947ec8a05d2b081e79c3f01e6d93b7923310ca9fb'
AND (
token = 'nPakx6whiNcyG69IzCScamhtEUr02kBCjzCeHrFSTvA='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)