UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'H23+ef0caZg9RhHgeDWK7g/6tEUhLgIGlhDePIylBg4='
WHERE
key_id = 'c23906cce2c324081f925ec20b0517c6afc580302f7147be30abcc2d0e9d6e8d'
AND (
token = 'H23+ef0caZg9RhHgeDWK7g/6tEUhLgIGlhDePIylBg4='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)