UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'jGl5DC30SPT5tIwIW+ppsfCYyMLe7yDmaGTOl8NuaKg='
WHERE
key_id = '106b6fcb61107a3f836606155cf2339dbf847a7b455e0463daa56bff1d1cd850'
AND (
token = 'jGl5DC30SPT5tIwIW+ppsfCYyMLe7yDmaGTOl8NuaKg='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)