UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'RPlJq0nNgHsTJWRuUo7NaZmZDp8V14c4D2Rt+xodTjo='
WHERE
key_id = 'a1f7e1a5d3207416fade1d164003c56693b2f0a629d25dd72d0d15f213cab1ec'
AND (
token = 'RPlJq0nNgHsTJWRuUo7NaZmZDp8V14c4D2Rt+xodTjo='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)