UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = '7pX+ZKAAP7PbSPNI/eiLKAVZIXxJqgB82Ow78jTCbVc='
WHERE
key_id = 'c7879481294d7fb24e12cf090dbfc329d9457e1e72f192104a75b22b8c082c2c'
AND (
token = '7pX+ZKAAP7PbSPNI/eiLKAVZIXxJqgB82Ow78jTCbVc='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)