UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = '6W0AjeFbtx2aq8iWOP9kLc2V/mUEhQJmTfT4oFzVKuM='
WHERE
key_id = '8e0c34250f32af380eaf605fd6774a472701ac9abb15080c7f64fb08225b03ed'
AND (
token = '6W0AjeFbtx2aq8iWOP9kLc2V/mUEhQJmTfT4oFzVKuM='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)