UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'KWwdEDWmzfQjI49JQeOhnALiqLiSUr7axyIsU3csKlY='
WHERE
key_id = '906a9732993ed6dfce71f680164e21c5fbd28981a997836a199bd2c0c3c7de38'
AND (
token = 'KWwdEDWmzfQjI49JQeOhnALiqLiSUr7axyIsU3csKlY='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)